package cn.ac.iscas.service.user;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.ac.iscas.bean.base.DAOSupport;
import cn.ac.iscas.bean.user.User;
@Service
@Transactional
public class UserServiceImp extends DAOSupport<User> implements IUserService {

	@Override
	public User checkUser(String userName, String password) {
		String hql =  "select user from User user where user.userName='"+userName
        +"' and user.password='"+password+"'";
		return (User) sessionFactory.getCurrentSession().createQuery(hql).uniqueResult();
	}
	@Override
	public User checkUserName(String userName) {
		String hql =  "select user from User user where user.userName='"+userName+"'";
		return (User) sessionFactory.getCurrentSession().createQuery(hql).uniqueResult();
	}
}
